<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function fn1(a, b) {
				console.log(a + b);
			}

			var c = fn1(1, 2);
			// console.log(c); //undefined

			function fn2(a, b) {
				return a + b, a - b;
			}

			// console.log(fn2(6, 5));

			var fn3 = function(a, b) {
				return a + b; //return 结束函数，后面的代码不再执行
				console.log("-----------------------");
			}

			// console.log(fn3(1, 2));

			var fn4 = function(a, b) {
				return;
			}
			var f = fn4(1, 2);
			// console.log(f);


			var fn5 = function(a, b) {
				return a + b;
			}

			// console.log(fn5(1, 2, 3));
			// console.log(fn5(1)); //NaN

			var fn6 = function(a, b) {
				// arguments 数组，存储了传递的所有数据
				console.log("----------------------");
				for (var i = 0; i < arguments.length; i++) {
					console.log(arguments[i]);
				}
				console.log("----------------------");
				return a + b;
			}
			console.log(fn6(1, 2, 3));
		</script>
	</head>
	<body>
	</body>
</html>
